home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / internet / pwrtcp / ftp.fr_ / ftp.bin (.txt)
Encoding:
Visual Basic Form  |  1995-03-30  |  16.7 KB  |  597 lines

  1. VERSION 2.00
  2. Begin Form FTP 
  3.    Caption         =   "FTP Test"
  4.    ClientHeight    =   6756
  5.    ClientLeft      =   984
  6.    ClientTop       =   1968
  7.    ClientWidth     =   9660
  8.    Height          =   7128
  9.    Icon            =   FTP.FRX:0000
  10.    Left            =   936
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   6756
  13.    ScaleWidth      =   9660
  14.    Top             =   1644
  15.    Width           =   9756
  16.    Begin PowerTCP_FTP FTP1 
  17.       Flags           =   0
  18.       Left            =   5520
  19.       OemLicense      =   ""
  20.       Top             =   120
  21.    End
  22.    Begin TextBox Text3 
  23.       Height          =   2775
  24.       Left            =   3600
  25.       MultiLine       =   -1  'True
  26.       ScrollBars      =   3  'Both
  27.       TabIndex        =   48
  28.       Top             =   480
  29.       Width           =   2895
  30.    End
  31.    Begin TextBox Text1 
  32.       Height          =   2775
  33.       Left            =   6600
  34.       MultiLine       =   -1  'True
  35.       ScrollBars      =   3  'Both
  36.       TabIndex        =   47
  37.       Top             =   480
  38.       Width           =   2895
  39.    End
  40.    Begin CommandButton Command24 
  41.       Caption         =   "Misc3"
  42.       Height          =   255
  43.       Left            =   2160
  44.       TabIndex        =   45
  45.       Top             =   3000
  46.       Width           =   855
  47.    End
  48.    Begin CommandButton Command23 
  49.       Caption         =   "Misc2"
  50.       Height          =   255
  51.       Left            =   1200
  52.       TabIndex        =   44
  53.       Top             =   3000
  54.       Width           =   735
  55.    End
  56.    Begin CommandButton Command22 
  57.       Caption         =   "Misc1"
  58.       Height          =   255
  59.       Left            =   120
  60.       TabIndex        =   43
  61.       Top             =   3000
  62.       Width           =   855
  63.    End
  64.    Begin TextBox CommandStr 
  65.       Height          =   285
  66.       Left            =   1200
  67.       TabIndex        =   39
  68.       Text            =   "PWD"
  69.       Top             =   2640
  70.       Width           =   2175
  71.    End
  72.    Begin CommandButton Command18 
  73.       Caption         =   "Command"
  74.       Height          =   255
  75.       Left            =   120
  76.       TabIndex        =   38
  77.       Top             =   2640
  78.       Width           =   855
  79.    End
  80.    Begin TextBox FileSize 
  81.       Height          =   285
  82.       Left            =   1200
  83.       TabIndex        =   35
  84.       Text            =   "1024 512"
  85.       Top             =   2280
  86.       Width           =   1815
  87.    End
  88.    Begin CommandButton Command15 
  89.       Caption         =   "Allocate"
  90.       Height          =   255
  91.       Left            =   120
  92.       TabIndex        =   34
  93.       Top             =   2280
  94.       Width           =   855
  95.    End
  96.    Begin CommandButton Cle 
  97.       Caption         =   "Clear"
  98.       Height          =   255
  99.       Left            =   3720
  100.       TabIndex        =   32
  101.       Top             =   120
  102.       Width           =   735
  103.    End
  104.    Begin Frame Frame2 
  105.       Caption         =   "Data"
  106.       Height          =   2895
  107.       Left            =   120
  108.       TabIndex        =   19
  109.       Top             =   3360
  110.       Width           =   9375
  111.       Begin CommandButton Command25 
  112.          Caption         =   "RENAME"
  113.          Height          =   255
  114.          Left            =   960
  115.          TabIndex        =   46
  116.          Top             =   2520
  117.          Width           =   735
  118.       End
  119.       Begin CommandButton Command21 
  120.          Caption         =   "RMD"
  121.          Height          =   255
  122.          Left            =   120
  123.          TabIndex        =   42
  124.          Top             =   2520
  125.          Width           =   735
  126.       End
  127.       Begin CommandButton Command20 
  128.          Caption         =   "MKD"
  129.          Height          =   255
  130.          Left            =   120
  131.          TabIndex        =   41
  132.          Top             =   2160
  133.          Width           =   735
  134.       End
  135.       Begin CommandButton Command19 
  136.          Caption         =   "DELE"
  137.          Height          =   255
  138.          Left            =   2640
  139.          TabIndex        =   40
  140.          Top             =   2160
  141.          Width           =   735
  142.       End
  143.       Begin CommandButton Command17 
  144.          Caption         =   "CDUP"
  145.          Height          =   255
  146.          Left            =   960
  147.          TabIndex        =   37
  148.          Top             =   2160
  149.          Width           =   735
  150.       End
  151.       Begin CommandButton Command16 
  152.          Caption         =   "CWD"
  153.          Height          =   255
  154.          Left            =   960
  155.          TabIndex        =   36
  156.          Top             =   1800
  157.          Width           =   735
  158.       End
  159.       Begin TextBox LocalName 
  160.          Height          =   375
  161.          Left            =   1440
  162.          TabIndex        =   30
  163.          Text            =   "local.dat"
  164.          Top             =   840
  165.          Width           =   1695
  166.       End
  167.       Begin CommandButton Command13 
  168.          Caption         =   "ASCII"
  169.          Height          =   255
  170.          Left            =   120
  171.          TabIndex        =   28
  172.          Top             =   1800
  173.          Width           =   735
  174.       End
  175.       Begin CommandButton Command12 
  176.          Caption         =   "IMAGE"
  177.          Height          =   255
  178.          Left            =   120
  179.          TabIndex        =   27
  180.          Top             =   1440
  181.          Width           =   735
  182.       End
  183.       Begin CommandButton Command10 
  184.          Caption         =   "PWD"
  185.          Height          =   255
  186.          Left            =   960
  187.          TabIndex        =   25
  188.          Top             =   1440
  189.          Width           =   735
  190.       End
  191.       Begin CommandButton Command9 
  192.          Caption         =   "RETR"
  193.          Height          =   255
  194.          Left            =   1800
  195.          TabIndex        =   1
  196.          Top             =   2520
  197.          Width           =   735
  198.       End
  199.       Begin CommandButton Command8 
  200.          Caption         =   "APPE"
  201.          Height          =   255
  202.          Left            =   1800
  203.          TabIndex        =   2
  204.          Top             =   2160
  205.          Width           =   735
  206.       End
  207.       Begin CommandButton Command7 
  208.          Caption         =   "STOU"
  209.          Height          =   255
  210.          Left            =   1800
  211.          TabIndex        =   3
  212.          Top             =   1800
  213.          Width           =   735
  214.       End
  215.       Begin CommandButton Command6 
  216.          Caption         =   "STOR"
  217.          Height          =   255
  218.          Left            =   1800
  219.          TabIndex        =   8
  220.          Top             =   1440
  221.          Width           =   735
  222.       End
  223.       Begin TextBox Text2 
  224.          Height          =   2415
  225.          Left            =   3600
  226.          MultiLine       =   -1  'True
  227.          ScrollBars      =   3  'Both
  228.          TabIndex        =   24
  229.          Top             =   360
  230.          Width           =   5655
  231.       End
  232.       Begin CommandButton Command5 
  233.          Caption         =   "NLST"
  234.          Height          =   255
  235.          Left            =   2640
  236.          TabIndex        =   23
  237.          Top             =   1800
  238.          Width           =   735
  239.       End
  240.       Begin CommandButton Command4 
  241.          Caption         =   "LIST"
  242.          Height          =   255
  243.          Left            =   2640
  244.          TabIndex        =   22
  245.          Top             =   1440
  246.          Width           =   735
  247.       End
  248.       Begin TextBox PathName 
  249.          Height          =   375
  250.          Left            =   1440
  251.          TabIndex        =   21
  252.          Text            =   "test.ftp"
  253.          Top             =   360
  254.          Width           =   1695
  255.       End
  256.       Begin Label Label7 
  257.          Caption         =   "LocalName"
  258.          Height          =   255
  259.          Left            =   120
  260.          TabIndex        =   29
  261.          Top             =   840
  262.          Width           =   975
  263.       End
  264.       Begin Label Label6 
  265.          Caption         =   "RemoteName"
  266.          Height          =   255
  267.          Left            =   120
  268.          TabIndex        =   20
  269.          Top             =   360
  270.          Width           =   1215
  271.       End
  272.    End
  273.    Begin TextBox User 
  274.       Height          =   285
  275.       Left            =   1200
  276.       TabIndex        =   5
  277.       Text            =   "Name"
  278.       Top             =   840
  279.       Width           =   1095
  280.    End
  281.    Begin TextBox Host 
  282.       Height          =   285
  283.       Left            =   1200
  284.       TabIndex        =   4
  285.       Text            =   "Name"
  286.       Top             =   480
  287.       Width           =   1095
  288.    End
  289.    Begin CommandButton Abort 
  290.       Caption         =   "Abort"
  291.       Height          =   255
  292.       Left            =   2400
  293.       TabIndex        =   11
  294.       Top             =   1080
  295.       Width           =   855
  296.    End
  297.    Begin CommandButton Command2 
  298.       Caption         =   "Logout"
  299.       Height          =   255
  300.       Left            =   2400
  301.       TabIndex        =   10
  302.       Top             =   1440
  303.       Width           =   855
  304.    End
  305.    Begin CommandButton Command1 
  306.       Caption         =   "Login"
  307.       Height          =   255
  308.       Left            =   2400
  309.       TabIndex        =   9
  310.       Top             =   360
  311.       Width           =   855
  312.    End
  313.    Begin TextBox Acct 
  314.       Height          =   285
  315.       Left            =   1200
  316.       TabIndex        =   7
  317.       Text            =   "Name"
  318.       Top             =   1560
  319.       Width           =   1095
  320.    End
  321.    Begin TextBox Pass 
  322.       Height          =   285
  323.       Left            =   1200
  324.       TabIndex        =   6
  325.       Text            =   "*******"
  326.       Top             =   1200
  327.       Width           =   1095
  328.    End
  329.    Begin CommandButton Command3 
  330.       Caption         =   "Clear"
  331.       Height          =   255
  332.       Left            =   6600
  333.       TabIndex        =   14
  334.       Top             =   120
  335.       Width           =   735
  336.    End
  337.    Begin Frame Frame1 
  338.       BackColor       =   &H00FFFFFF&
  339.       Caption         =   "Login/Logout"
  340.       ClipControls    =   0   'False
  341.       Height          =   2055
  342.       Left            =   120
  343.       TabIndex        =   0
  344.       Top             =   120
  345.       Width           =   3255
  346.       Begin CommandButton Command14 
  347.          Caption         =   "Kill"
  348.          Height          =   255
  349.          Left            =   2280
  350.          TabIndex        =   31
  351.          Top             =   1680
  352.          Width           =   855
  353.       End
  354.       Begin CommandButton Command11 
  355.          Caption         =   "Rein"
  356.          Height          =   255
  357.          Left            =   2280
  358.          TabIndex        =   26
  359.          Top             =   600
  360.          Width           =   855
  361.       End
  362.       Begin Label Label5 
  363.          Caption         =   "Account"
  364.          Height          =   255
  365.          Left            =   120
  366.          TabIndex        =   18
  367.          Top             =   1440
  368.          Width           =   735
  369.       End
  370.       Begin Label Label4 
  371.          Caption         =   "Password"
  372.          Height          =   255
  373.          Left            =   120
  374.          TabIndex        =   17
  375.          Top             =   1080
  376.          Width           =   855
  377.       End
  378.       Begin Label Label3 
  379.          Caption         =   "User"
  380.          Height          =   255
  381.          Left            =   120
  382.          TabIndex        =   16
  383.          Top             =   720
  384.          Width           =   615
  385.       End
  386.       Begin Label Label1 
  387.          Caption         =   "Host"
  388.          Height          =   255
  389.          Left            =   120
  390.          TabIndex        =   15
  391.          Top             =   360
  392.          Width           =   615
  393.       End
  394.    End
  395.    Begin Label Label2 
  396.       Caption         =   "Log"
  397.       Height          =   255
  398.       Index           =   1
  399.       Left            =   4680
  400.       TabIndex        =   33
  401.       Top             =   120
  402.       Width           =   495
  403.    End
  404.    Begin Label Status1 
  405.       BackColor       =   &H00C0C0C0&
  406.       Height          =   375
  407.       Left            =   0
  408.       TabIndex        =   13
  409.       Top             =   6360
  410.       Width           =   4815
  411.    End
  412.    Begin Label Label2 
  413.       Caption         =   "Replies"
  414.       Height          =   255
  415.       Index           =   0
  416.       Left            =   7560
  417.       TabIndex        =   12
  418.       Top             =   120
  419.       Width           =   735
  420.    End
  421. Dim FileNum As Integer  ' local to form
  422. Sub Abort_Click ()
  423.     FTP1.Abort = True
  424. End Sub
  425. Sub Cle_Click ()
  426.     Text3 = ""
  427. End Sub
  428. Sub Command1_Click ()
  429.     Text1 = ""
  430.     Text3 = ""
  431.     FTP1.User = User
  432.     FTP1.Password = Pass
  433.     FTP1.Account = Acct
  434.     FTP1.LoginHost = Host
  435. End Sub
  436. Sub Command10_Click ()
  437.     FTP1.PrintWorkingDir = True
  438. End Sub
  439. Sub Command11_Click ()
  440.     FTP1.Reinitialize = True
  441. End Sub
  442. Sub Command12_Click ()
  443.     FTP1.Type = "I"
  444. End Sub
  445. Sub Command13_Click ()
  446.     FTP1.Type = "A"
  447. End Sub
  448. Sub Command14_Click ()
  449.     FTP1.CloseControl = True
  450. End Sub
  451. Sub Command15_Click ()
  452.     FTP1.Allocate = FileSize
  453. End Sub
  454. Sub Command16_Click ()
  455.     FTP1.ChDir = PathName
  456. End Sub
  457. Sub Command17_Click ()
  458.     FTP1.ChDirUp = True
  459. End Sub
  460. Sub Command18_Click ()
  461.     FTP1.Command = CommandStr
  462. End Sub
  463. Sub Command19_Click ()
  464.     FTP1.Dele = PathName
  465. End Sub
  466. Sub Command2_Click ()
  467.     FTP1.Logout = True
  468. End Sub
  469. Sub Command20_Click ()
  470.     FTP1.MakeDir = PathName
  471. End Sub
  472. Sub Command21_Click ()
  473.     FTP1.RemoveDir = PathName
  474. End Sub
  475. Sub Command22_Click ()
  476.     FTP1.Restart = CommandStr
  477. End Sub
  478. Sub Command23_Click ()
  479.     FTP1.Status = CommandStr
  480. End Sub
  481. Sub Command24_Click ()
  482.     FTP1.System = True
  483. End Sub
  484. Sub Command25_Click ()
  485.     FTP1.Rename = PathName
  486. End Sub
  487. Sub Command3_Click ()
  488.     Text1 = ""
  489. End Sub
  490. Sub Command4_Click ()
  491.     Text2.Text = ""
  492.     FileNum = 0
  493.     FTP1.List = PathName
  494. End Sub
  495. Sub Command5_Click ()
  496.     Text2.Text = ""
  497.     FTP1.NameList = PathName
  498. End Sub
  499. Sub Command6_Click ()
  500.     Text2.Text = ""
  501.     FileNum = 2' read data from file
  502.     'FileNum = 10 'put in bit bucket
  503.     Open LocalName For Binary Access Read As #2
  504.     FTP1.Store = PathName
  505. End Sub
  506. Sub Command7_Click ()
  507.     Text2.Text = ""
  508.     FileNum = 2' read data from file
  509.     'FileNum = 10 'put in bit bucket
  510.     Open LocalName For Binary Access Read As #2
  511.     FTP1.StoreUnique = PathName
  512. End Sub
  513. Sub Command8_Click ()
  514.     Text2.Text = ""
  515.     FileNum = 2' read data from file
  516.     'FileNum = 10 'put in bit bucket
  517.     Open LocalName For Binary Access Read As #2
  518.     FTP1.Appe = PathName
  519. End Sub
  520. Sub Command9_Click ()
  521.     Text2.Text = ""
  522.     FileNum = 1' save data to file
  523.     'FileNum = 2 'put in bit bucket
  524.     Open LocalName For Output As #1
  525.     FTP1.Retrieve = PathName
  526. End Sub
  527. Sub Form_Load ()
  528.     FileNum = 0
  529.     FTP1.User = User
  530.     FTP1.Password = Pass
  531.     FTP1.Account = Acct
  532.     'FTP1.LoginHost = Host
  533. End Sub
  534. Sub Form_Unload (Cancel As Integer)
  535.     End
  536. End Sub
  537. Sub FTP1_Log (Message As String)
  538.     Text3 = Text3 & Message & Chr$(13) & Chr$(10)
  539. End Sub
  540. Sub FTP1_Recv (RecvData As String)
  541.     Select Case FileNum
  542.     Case 0
  543.         ' put data to edit box: list or name list
  544.         Text2 = Text2 & RecvData
  545.     Case 1
  546.         ' put data into open file
  547.         If RecvData = "" Then
  548.             Close #1
  549.             FileNum = 0
  550.         Else
  551.             Print #1, RecvData;
  552.         End If
  553.     End Select
  554. End Sub
  555. Sub FTP1_Reply (Status As Integer, LastCommand As Integer, Code As Integer, Reply As String)
  556.     Text1 = Text1 & Reply & Chr$(13) & Chr$(10)
  557.     Select Case (Status)
  558.     Case FTP_UNKNOWN    ' spontaneous data or reply from Command
  559.         Status1 = "Unknown"
  560.     Case FTP_SUCCESS    ' operation completed sucessfully
  561.         Status1 = "Success"
  562.         'If Code = 226 And FileNum = 1 Then
  563.             ' file transfer successful
  564.             'Close #FileNum
  565.             'FileNum = 0
  566.         'End If
  567.     Case FTP_ERROR      ' unexpected error
  568.         Status1 = "Error"
  569.         If FileNum = 1 Then
  570.             Close #1
  571.             FileNum = 0
  572.         End If
  573.     Case FTP_FAILURE    ' failure to complete successfully
  574.         Status1 = "Failure"
  575.         If FileNum = 1 Then
  576.             Close #1
  577.             FileNum = 0
  578.         End If
  579.     Case FTP_WORKING    ' informative...wait for next
  580.         Status1 = "Working"
  581.     End Select
  582. End Sub
  583. Sub FTP1_Send (Tag As Long)
  584.     ' get data from open file
  585.     Location = Loc(2)
  586.     LengthOfFile = LOF(2)
  587.     Transfer = LengthOfFile - Location
  588.     If Transfer > 12000 Then Transfer = 12000
  589.     If Transfer > 0 Then
  590.         FTP1.Send = Input$(Transfer, #2)
  591.     Else
  592.         FTP1.CloseData = True
  593.         Close #2
  594.         FileNum = 0
  595.     End If
  596. End Sub
  597.